#include "testApp.h"

//--------------------------------------------------------------
void testApp::setup(){
    
    pup.loadImage("pup.jpg");
    
    pos.set(ofGetWidth()/2, ofGetHeight()/2);

    vel.set(0, 0);
    
    pup.setAnchorPercent(0.5, 0.5);
    
//    for(int i = 0; i < pup.width * pup.height * 3; i += 3){
//        pup.getPixels()[i + 0] = 0;  //R
//        //pup.getPixels()[i + 1] = 0;  //G
//        pup.getPixels()[i + 2] = 0;  //B
//    }
    
    for(int x = 0; x < pup.width; x++){
        for(int y = 0; y < pup.height; y++){
            int i = (y * pup.width + x) * 3;
            
            if(x%2 == 0){
                pup.getPixels()[i + 0] = 255;
                pup.getPixels()[i + 1] = 0;
                pup.getPixels()[i + 2] = 0;
            }
        }
    }
    
    pup.update();
}

//--------------------------------------------------------------
void testApp::update(){
    pos += vel;
}

//--------------------------------------------------------------
void testApp::draw(){
    pup.draw(pos);
}

//--------------------------------------------------------------
void testApp::keyPressed(int key){

}

//--------------------------------------------------------------
void testApp::keyReleased(int key){

}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){

}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::windowResized(int w, int h){

}

//--------------------------------------------------------------
void testApp::gotMessage(ofMessage msg){

}

//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo){ 

}